<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../rurple.css" type="text/css" />

<title>Building walls</title>
</head>
<body>
<h2 class="title">9. Building walls</h2>

<p>You can easily change Reeborg's world by adding walls. To do so, you click
on <img alt="edit walls button" src="../../images/intro/btn_walls.png" /> and
the display changes to look like this:</p>

<div class="pcenter"><img alt="buildwalls" src=
"../../images/intro/buildwalls.png" />
</div>

<p>By clicking on the red dotted line between two "pillars" you can either
add or delete a wall. Note that you can't remove walls on the border.</p>

<div class="pcenter"><img alt="wall1img" src="../../images/intro/wall1img.png" /></div>

<p>When you click on <img alt="edit walls button" src=
"../../images/intro/btn_walls.png" /> again, the pillars are removed and the
red dotted lines disappear, but the new wall remains.</p>

<h3 class="try">Your turn</h3>

<p>Create a world like the one indicated below (and <span class=
"important">save</span> it, as you've seen how a few lessons ago) and then
write a program that guides Reeborg to emerge at the bottom of the simple
maze following the path indicated.</p>

<div><img alt="loopstart" src="../../images/intro/loopstart.png" />
<img alt="lead to" src="../../images/lead_to.png" /> <img alt="loopend" src=
"../../images/intro/loopend.png" /></div>

<!--=====================================================-->
<hr class="line" />

<h3 class="suggested">Challenges</h3>

<p>We end this lesson with a few exercises. The exercises in this lesson
should not be too difficult to do; actually, at this stage, they might even
feel a bit tedious ... but they will <b>really</b> help you in the following
lessons.</p>

<h3 class="quiz">Newspaper delivery</h3>

<p>Reeborg delivers newspapers in his local neighbourhood. Have him climb the
stairs to the front door of a house, drop the newspaper (represented by a
beeper) on the top step, and return to his starting point as illustrated
below. The world file is newspaper.wld.</p>

<div class="pcenter"><img alt="newspaper start" src=
"../../images/intro/newspaper_start.png" /></div>
<div class="pcenter"><img alt="lead to" src="../../images/lead_to.png" /> <img alt=
"newspaper end" src="../../images/intro/newspaper_end.png" /></div>

<p>To accomplish this task, you will find that you need Reeborg to follow
more than 50 commands, which requires a fair bit of typing. The more typing
one does, the more errors (bugs!) can occur. In the next chapter we will see 
how to use Python to simplify considerably the solution to this exercise.</p>

<!--=====================================================-->
<hr class="line" />

<h3 class="quiz">Jumping hurdles</h3>

<p>Reeborg has entered a hurdles race. Write a program that have him follow
the path indicated below in his way to the finish line. The world file is
hurdles1.wld.</p>

<div class="pcenter"><img alt="hurdles start" src=
"../../images/intro/hurdles1_start.png" /></div>
<div class="pcenter"><img alt="lead to" src="../../images/lead_to.png" /> <img alt=
"hurdles end" src="../../images/intro/hurdles1_end.png" /></div>

<p>In the next lesson we will see how to write a short program to accomplish
the same task. Later, we will learn how to teach Reeborg to automatically
jump over hurdles of different heights and unevenly spaced.</p>

<!--=====================================================-->
<hr class="line" />

<h3 class="quiz">Harvest time</h3>

<p>It's harvest time! Have Reeborg pick up all the carrots (represented by
beepers) in this garden. The world file is harvest1.wld.</p>

<p><img alt="harvest start" src="../../images/intro/harvest1.png" /></p>

<p>Later, we will learn how to write a much shorter program to accomplish the
same task. Then, we will teach Reeborg how to handle on his own situations
where there are missing carrots at arbitrary places in the garden.</p>

<!--=====================================================-->
<hr class="line" />

<h3 class="quiz">Amazing escape</h3>

<p>Reeborg is lost in a maze. Help him find his way out. The shortest
possible path is indicated below. The world file is maze1.wld.</p>

<div><img alt="maze start" src="../../images/intro/maze1_start.png" />
<img alt="lead to" src="../../images/lead_to.png" /> <img alt="maze end" src=
"../../images/intro/maze1_end.png" /></div>

<p>In a later lesson, we will see how to have Reeborg find his way out on his
own, alwayd using the <b>same</b> program to get out of many different mazes.</p>

<div class="lessons_nav">
<a href="8-bugs.htm"><img alt="previous" src=
"../../images/previous.png" /> Darn bugs!</a> - 
<a href="../lessons_toc.htm"><img alt=
"home" src="../../images/home.png" /></a> - <a href="10-def.htm">Definitely
avoiding repetitions <img alt="next" src=
"../../images/next.png" /></a>
</div>
</body>
</html>
